import 'package:flutter/material.dart';
import 'package:sml_policies/locator/locator.dart';
import 'package:sml_policies/ui/permissions_dialog.dart';
import 'package:sml_policies/ui/agreement_view_dialog.dart';

class NewSmlPolicies extends StatefulWidget {
  const NewSmlPolicies({Key? key}) : super(key: key);

  @override
  State<NewSmlPolicies> createState() => _NewSmlPoliciesState();
}

class _NewSmlPoliciesState extends State<NewSmlPolicies> {

  @override
  void initState() {
    initSync();
    super.initState();
  }

  initSync() async {
    Future.delayed(const Duration(milliseconds: 500), () async {
      await PermissionsDialog().show(context);
      await AgreementViewDialog().show(context);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        child: ElevatedButton(
          onPressed: () { 
            initSync();
          }, 
          child: Text('open dialog'),
        ),
      ),
    );
  }
}
